imf_program +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest,
data = survival_data)
stargazer(cox1,cox2, type="text",
omit = c("iso3c","stop"), dep.var.labels = "Time to Policy Passage",
covariate.labels = c("Natural Resource Term Frequency","Natural Resource Term Frequency (TF--IDF)",
"Technocratic Finance Minister = 1", "FDI Performance Index",
"IMF Program = 1",
"Resource Rents, t--1", "Log GDP Per Capita, t--1", "GDP Growth, t--1", "Field Discovery = 1, t--1",
"Polyarchy", "Left Executive", "Protest Count"),
keep.stat = c("n", "rsq", "ll", "logrank", "wald"))
rm(list=ls())
# generate table 1
# load packages
library(rio) # load data
library(tidyverse) # data manipulation
library(fect) # estimate difference in differences
library(knitr) # generate table to export results
data_with_dictionary <- import("data/full_data.csv")
# model 1, table 1
fect1 <- fect(policy_passage ~ article_iv_promotes_governance_lag + imf_program + field_discovery_lag + log_gdp_per_capita_lag  + gdp_growth_lag,
data = data_with_dictionary, index = c("iso3c","year"),
method = "fe", force = "two-way", seed = 1904,
se = TRUE, nboots = 1000)
# model 2, table 1
fect2 <- fect(policy_passage ~ article_iv_mentions_resources_lag + imf_program + field_discovery_lag + log_gdp_per_capita_lag + gdp_growth_lag,
data = data_with_dictionary, index = c("iso3c","year"),
method = "fe", force = "two-way", seed = 1904,
se = TRUE, nboots = 1000)
# note that you need to change the working directory in the source file as well
plot3 <- plot(fect1, type = "calendar",  main = "(a) Treatment: Consultation Promotes Natural Resource Governance",
ylab = "Effect on the Probability of Policy Passage",
xlab = "Year", ylim = c(-0.6,0.6)) + theme_classic() +
theme(plot.title = element_text(face="bold")) + theme(plot.margin = margin(0.1,0.4,0.1,0.1, "cm"))
plot4 <- plot(fect2, type = "calendar",  main = "(b) Treatment: Consultation Uses Natural Resource Terms",
ylab = "Effect on the Probability of Policy Passage",
xlab = "Year", ylim = c(-0.6,0.6)) + theme_classic() +
theme(plot.title = element_text(face="bold")) + theme(plot.margin = margin(0.1,0.4,0.1,0.1, "cm"))
ggarrange(plot3,plot4, ncol = 2)
library(ggpubr) # combine different plots
# note that you need to change the working directory in the source file as well
plot3 <- plot(fect1, type = "calendar",  main = "(a) Treatment: Consultation Promotes Natural Resource Governance",
ylab = "Effect on the Probability of Policy Passage",
xlab = "Year", ylim = c(-0.6,0.6)) + theme_classic() +
theme(plot.title = element_text(face="bold")) + theme(plot.margin = margin(0.1,0.4,0.1,0.1, "cm"))
plot4 <- plot(fect2, type = "calendar",  main = "(b) Treatment: Consultation Uses Natural Resource Terms",
ylab = "Effect on the Probability of Policy Passage",
xlab = "Year", ylim = c(-0.6,0.6)) + theme_classic() +
theme(plot.title = element_text(face="bold")) + theme(plot.margin = margin(0.1,0.4,0.1,0.1, "cm"))
ggarrange(plot3,plot4, ncol = 2)
ggarrange(plot3,plot4, ncol = 2) %>%
ggexport(filename = "figures/figE1.pdf", width = 14, height = 5)
plot5 <- plot(fect1, type = "equiv", main = "(a) Treatment: Consultation Promotes Natural Resource Governance",
ylab = "Effect on the Probability of Policy Passage",
cex.legend = 0.6, cex.text = 0.8, ylim = c(-0.1,0.1), stats = c("equiv.p")) + theme_classic() +
theme(plot.title = element_text(face="bold"),legend.position="bottom")
plot6 <- plot(fect2, type = "equiv", main = "(b) Treatment: Consultation Uses Natural Resource Terms",
ylab = "Effect on the Probability of Policy Passage",
cex.legend = 0.6, cex.text = 0.8, ylim = c(-0.1,0.1), stats = c("equiv.p")) + theme_classic() +
theme(plot.title = element_text(face="bold"),legend.position="bottom")
ggarrange(plot5,plot6, ncol = 2)
ggarrange(plot5,plot6, ncol = 2) %>%
ggexport(filename = "figures/figE2.pdf", width = 14, height = 5)
# re-estimate model 1 with placeboTest = T
fect_placebo1 <- fect(policy_passage ~ article_iv_promotes_governance_lag + imf_program + field_discovery_lag + log_gdp_per_capita_lag + gdp_growth_lag,
data = data_with_dictionary, index = c("iso3c","year"),
method = "fe", force = "two-way", seed = 1904,
se = TRUE, nboots = 1000, CV = 0, placeboTest = TRUE, placebo.period = c(-3, -1))
plot7 <- plot(fect_placebo1, cex.text = 0.8, stats = c("equiv.p"),
main = "(a) Treatment: Consultation Promotes Natural Resource Governance",
ylab = "Effect on the Probability of Policy Passage") + theme_classic() +
theme(plot.title = element_text(face="bold"),legend.position="bottom")
# re-estimate model 2 with placeboTest = T
fect_placebo2 <- fect(policy_passage ~ article_iv_mentions_resources_lag + imf_program + field_discovery_lag + log_gdp_per_capita_lag + gdp_growth_lag,
data = data_with_dictionary, index = c("iso3c","year"),
method = "fe", force = "two-way", seed = 1904,
se = TRUE, nboots = 1000, CV = 0, placeboTest = TRUE, placebo.period = c(-3, -1))
plot8 <- plot(fect_placebo2, cex.text = 0.8, stats = c("equiv.p"),
main = "(b) Treatment: Consultation Uses Natural Resource Terms",
ylab = "Effect on the Probability of Policy Passage") + theme_classic() +
theme(plot.title = element_text(face="bold"),legend.position="bottom")
ggarrange(plot7,plot8, ncol = 2)
ggarrange(plot7,plot8, ncol = 2) %>%
ggexport(filename = "figures/figE3.pdf", width = 14, height = 5)
# load data for analysis
data_with_dictionary <- import("data/full_data.csv")
# model 1, table 1
fect1 <- fect(policy_passage ~ article_iv_promotes_governance + imf_program + field_discovery_lag + log_gdp_per_capita_lag  + gdp_growth_lag,
data = data_with_dictionary, index = c("iso3c","year"),
method = "fe", force = "two-way", seed = 1904,
se = TRUE, nboots = 1000)
# model 2, table 1
fect2 <- fect(policy_passage ~ article_iv_mentions_resources + imf_program + field_discovery_lag + log_gdp_per_capita_lag + gdp_growth_lag,
data = data_with_dictionary, index = c("iso3c","year"),
method = "fe", force = "two-way", seed = 1904,
se = TRUE, nboots = 1000)
plot9 <- plot(fect1, main = "(a) Treatment: Consultation Promotes Natural Resource Governance",
ylab = "Effect on the Probability of Policy Passage",
xlab = "Years Since Treatment Began", cex.main = 0.8, cex.lab = 0.8,
cex.axis = 0.8, proportion = 0.05, show.point = TRUE, xlim = c(-2,3), ylim = c(-0.2,0.25)) + theme_classic() +
theme(plot.title = element_text(face="bold"))
plot10 <- plot(fect2, main = "(b) Treatment: Consultation Uses Natural Resource Terms",
ylab = "Effect on the Probability of Policy Passage",
xlab = "Years Since Treatment Began", cex.main = 0.8, cex.lab = 0.8,
cex.axis = 0.8, proportion = 0.05, show.point = TRUE, xlim = c(-2,3), ylim = c(-0.2,0.25)) + theme_classic() +
theme(plot.title = element_text(face="bold"))
ggarrange(plot9,plot10, ncol = 2)
ggarrange(plot9,plot10, ncol = 2) %>%
ggexport(filename = "figures/figE4.pdf", width = 14, height = 5)
# generate table F1
# load packages
library(rio) # load data
library(tidyverse) # data manipulation
library(stargazer) # generate tables
library(brglm2) # estimate penalized logit
library(lmtest) # cluster standard errors
library(sandwich) # cluster standard errors
# load data for analysis
data_with_dictionary <- import("data/full_data.csv") %>%
mutate(across(c(imf_program,field_discovery,grad_school_econ_usa,iso3c,year), as.factor)) # treat factors as factors
# model 1, table F1
logit1 <- glm(policy_passage ~ resource_mentions_absolute_lag +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c,
data = data_with_dictionary, family = binomial(link="logit"), method = "brglmFit",
slowit = 0.8, maxit = 500)
# cluster standard errors
logit1_r <- logit1 %>%
coeftest(vcovHC(logit1, type = 'HC0', cluster =  ~ iso3c))
# generate table F1
stargazer(logit1_r, # type = "text",
omit = c("iso3c","year"),
dep.var.labels = "Policy Passage",
covariate.labels = c("Natural Resource Term Frequency", "Previous Policy Passage = 1",
"Technocratic Finance Minister = 1", "FDI Performance Index",
"IMF Program = 1", "Crude Oil Price, t--1", "Crude Oil Price, Delta",
"Resource Rents, t--1", "Log GDP Per Capita, t--1", "GDP Growth, t--1", "Field Discovery = 1, t--1",
"Polyarchy", "Left Executive", "Protest Count"))
# generate table F1
stargazer(logit1_r, # type = "text",
omit = c("iso3c","year"),
dep.var.labels = "Policy Passage",
covariate.labels = c("Natural Resource Term Frequency, t--1", "Previous Policy Passage = 1",
"Technocratic Finance Minister = 1", "FDI Performance Index",
"IMF Program = 1", "Crude Oil Price, t--1", "Crude Oil Price, Delta",
"Resource Rents, t--1", "Log GDP Per Capita, t--1", "GDP Growth, t--1", "Field Discovery = 1, t--1",
"Polyarchy", "Left Executive", "Protest Count"))
# retrieve fit stats
stargazer(logit1, # type = "text",
omit = c("iso3c","year"),
dep.var.labels = "Policy Passage",
covariate.labels = c("Natural Resource Term Frequency, t--1", "Previous Policy Passage = 1",
"Technocratic Finance Minister = 1", "FDI Performance Index",
"IMF Program = 1", "Crude Oil Price, t--1", "Crude Oil Price, Delta",
"Resource Rents, t--1", "Log GDP Per Capita, t--1", "GDP Growth, t--1", "Field Discovery = 1, t--1",
"Polyarchy", "Left Executive", "Protest Count"))
exp(0.125)
data_with_dictionary <- import("data/full_data.csv") %>%
mutate(across(c(imf_program,field_discovery,grad_school_econ_usa,iso3c,year), as.factor)) # treat factors as factors
# model 1, table F2
ols1 <- lm(policy_passage ~ resource_mentions_tfidf_lag +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c, data = data_with_dictionary)
# cluster standard errors
ols1_r <- ols1 %>%
coeftest(vcovHC(ols1, type = 'HC0', cluster =  ~ iso3c))
# model 2, table F2
logit1 <- glm(policy_passage ~ resource_mentions_tfidf_lag +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c,
data = data_with_dictionary, family = binomial(link="logit"), method = "brglmFit",
slowit = 0.8, maxit = 500)
# cluster standard errors
logit1_r <- logit1 %>%
coeftest(vcovHC(logit1, type = 'HC0', cluster =  ~ iso3c))
# generate table F2
stargazer(ols1_r,logit1_r, # type = "text",
omit = c("iso3c","year"),
dep.var.labels = "Policy Passage",
covariate.labels = c("Natural Resource Term Frequency (TF-IDF), t--1", "Previous Policy Passage = 1",
"Technocratic Finance Minister = 1", "FDI Performance Index",
"IMF Program = 1", "Crude Oil Price, t--1", "Crude Oil Price, Delta",
"Resource Rents, t--1", "Log GDP Per Capita, t--1", "GDP Growth, t--1", "Field Discovery = 1, t--1",
"Polyarchy", "Left Executive", "Protest Count"),
keep.stat = c("n", "rsq", "f", "ll", "aic"))
# retrieve fit stats
stargazer(ols1,logit1, # type = "text",
omit = c("iso3c","year"),
dep.var.labels = "Policy Passage",
covariate.labels = c("Natural Resource Term Frequency (TF-IDF), t--1", "Previous Policy Passage = 1",
"Technocratic Finance Minister = 1", "FDI Performance Index",
"IMF Program = 1", "Crude Oil Price, t--1", "Crude Oil Price, Delta",
"Resource Rents, t--1", "Log GDP Per Capita, t--1", "GDP Growth, t--1", "Field Discovery = 1, t--1",
"Polyarchy", "Left Executive", "Protest Count"),
keep.stat = c("n", "rsq", "f", "ll", "aic"))
# load packages
library(rio) # load data
library(tidyverse) # data manipulation
library(stargazer) # generate tables
library(ivreg) # estimate 2SLS
library(lmtest) # cluster standard errors
library(sandwich) # cluster standard errors
# load data for analysis
data_with_dictionary <- import("data/full_data.csv") %>%
mutate(across(c(imf_program,field_discovery,grad_school_econ_usa,iso3c,year), as.factor)) %>% # treat factors as factors
# generate instruments
group_by(iso3c) %>%
mutate(country_specific_resource_mentions_absolute = mean(resource_mentions_absolute),
country_specific_resource_mentions_tfidf = mean(resource_mentions_tfidf)) %>%
ungroup() %>%
group_by(year) %>%
mutate(year_specific_resource_mentions_absolute = mean(resource_mentions_absolute),
year_specific_resource_mentions_tfidf = mean(resource_mentions_tfidf)) %>%
ungroup() %>%
mutate(instrument_absolute = country_specific_resource_mentions_absolute * year_specific_resource_mentions_absolute,
instrument_tfidf = country_specific_resource_mentions_tfidf * year_specific_resource_mentions_tfidf)
# model 1, table F3
ivreg1 <- ivreg(policy_passage ~ resource_mentions_absolute_lag +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c |
instrument_absolute +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c, data = data_with_dictionary)
# cluster standard errors
ivreg1_r <- ivreg1 %>%
coeftest(vcovHC(ivreg1, type = 'HC0', cluster =  ~ iso3c))
# model 2, table F3
ivreg2 <- ivreg(policy_passage ~ resource_mentions_tfidf_lag +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c |
instrument_tfidf +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c, data = data_with_dictionary)
# cluster standard errors
ivreg2_r <- ivreg2 %>%
coeftest(vcovHC(ivreg2, type = 'HC0', cluster =  ~ iso3c))
summary(ivreg1, diagnostics = T)
summary(ivreg2, diagnostics = T)
# generate table F3
stargazer(ivreg1_r,ivreg2_r, # type = "text",
omit = c("iso3c","year"),
dep.var.labels = "Policy Passage",
covariate.labels = c("Natural Resource Term Frequency","Natural Resource Term Frequency (TF--IDF)",
"Previous Policy Passage = 1",
"Technocratic Finance Minister = 1", "FDI Performance Index",
"IMF Program = 1", "Crude Oil Price, t--1", "Crude Oil Price, Delta",
"Resource Rents, t--1", "Log GDP Per Capita, t--1", "GDP Growth, t--1", "Field Discovery = 1, t--1",
"Polyarchy", "Left Executive", "Protest Count"),
add.lines = list(c("F-Statistic for Instrument","14.364***","14.364***"), c("Wu-Hausman","0.013","0.013")),
keep.stat = c("n", "rsq", "f"))
# generate table F3
stargazer(ivreg1_r,ivreg2_r, # type = "text",
omit = c("iso3c","year"),
dep.var.labels = "Policy Passage",
covariate.labels = c("Natural Resource Term Frequency, t--1","Natural Resource Term Frequency (TF--IDF), t--1",
"Previous Policy Passage = 1",
"Technocratic Finance Minister = 1", "FDI Performance Index",
"IMF Program = 1", "Crude Oil Price, t--1", "Crude Oil Price, Delta",
"Resource Rents, t--1", "Log GDP Per Capita, t--1", "GDP Growth, t--1", "Field Discovery = 1, t--1",
"Polyarchy", "Left Executive", "Protest Count"),
add.lines = list(c("F-Statistic for Instrument","14.364***","14.364***"), c("Wu-Hausman","0.013","0.013")),
keep.stat = c("n", "rsq", "f"))
# retrieve fit stats
stargazer(ivreg1,ivreg2, # type = "text",
omit = c("iso3c","year"),
dep.var.labels = "Policy Passage",
covariate.labels = c("Natural Resource Term Frequency","Natural Resource Term Frequency (TF--IDF)",
"Previous Policy Passage = 1",
"Technocratic Finance Minister = 1", "FDI Performance Index",
"IMF Program = 1", "Crude Oil Price, t--1", "Crude Oil Price, Delta",
"Resource Rents, t--1", "Log GDP Per Capita, t--1", "GDP Growth, t--1", "Field Discovery = 1, t--1",
"Polyarchy", "Left Executive", "Protest Count"),
add.lines = list(c("F-Statistic for Instrument","14.364***","14.364***"), c("Wu-Hausman","0.013","0.013")),
keep.stat = c("n", "rsq", "f"))
# model 1, table F4
first_stage1 <- lm(resource_mentions_absolute_lag ~ instrument_absolute +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c, data = data_with_dictionary)
# cluster standard errors
first_stage1_r <- first_stage1 %>%
coeftest(vcovHC(first_stage1, type = 'HC0', cluster =  ~ iso3c))
# model 2, table F4
first_stage2 <- lm(resource_mentions_tfidf_lag ~ instrument_tfidf +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c, data = data_with_dictionary)
# cluster standard errors
first_stage2_r <- first_stage2 %>%
coeftest(vcovHC(first_stage2, type = 'HC0', cluster =  ~ iso3c))
# generate table F4
stargazer(first_stage1_r,first_stage2_r, # type = "text",
dep.var.labels = c("Natural Resource Term Frequency","Natural Resource Term Frequency (TF--IDF)"),
omit = c("iso3c","year"),
covariate.labels = c("Instrument: Natural Resource Term Frequency","Instrument: Natural Resource Term Frequency (TF--IDF)",
"Previous Policy Passage = 1",
"Technocratic Finance Minister = 1", "FDI Performance Index",
"IMF Program = 1", "Crude Oil Price, t--1", "Crude Oil Price, Delta",
"Resource Rents, t--1", "Log GDP Per Capita, t--1", "GDP Growth, t--1", "Field Discovery = 1, t--1",
"Polyarchy", "Left Executive", "Protest Count"),
keep.stat = c("n", "rsq", "f"))
# retrieve fit stats
stargazer(first_stage1,first_stage2, dep.var.labels = c("Natural Resource Term Frequency","Natural Resource Term Frequency (TF--IDF)"), # type = "text",
omit = c("iso3c","year"),
covariate.labels = c("Instrument: Natural Resource Term Frequency","Instrument: Natural Resource Term Frequency (TF--IDF)",
"Previous Policy Passage = 1",
"Technocratic Finance Minister = 1", "FDI Performance Index",
"IMF Program = 1", "Crude Oil Price, t--1", "Crude Oil Price, Delta",
"Resource Rents, t--1", "Log GDP Per Capita, t--1", "GDP Growth, t--1", "Field Discovery = 1, t--1",
"Polyarchy", "Left Executive", "Protest Count"),
keep.stat = c("n", "rsq", "f"))
data_with_dictionary <- import("data/full_data.csv") %>%
mutate(across(c(imf_program,field_discovery,grad_school_econ_usa,iso3c,year), as.factor)) %>% # treat factors as factors
# rename variables so they look nicer in the figures
rename(`IMF Program` = imf_program,
`Field Discovery` = field_discovery_lag)
ols1 <- lm(policy_passage ~ resource_mentions_absolute_lag +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
`IMF Program` + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + `Field Discovery` +
polyarchy + left_executive + protest + year + iso3c, data = data_with_dictionary)
# benchmark: IMF program
content.sensitivity1 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute",
benchmark_covariates = "`IMF Program`1",
kd = 1:3) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
library(sensemakr) # sensitivity analysis
# benchmark: IMF program
content.sensitivity1 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute",
benchmark_covariates = "`IMF Program`1",
kd = 1:3) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
# benchmark: IMF program
content.sensitivity1 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute_lag",
benchmark_covariates = "`IMF Program`1",
kd = 1:3) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
# benchmark: field discovery
content.sensitivity2 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute_lag",
benchmark_covariates = "`Field Discovery`",
kd = 1:3) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
# table F5 is a combination of both tables below
ovb_minimal_reporting(content.sensitivity1)
# benchmark: IMF program
content.sensitivity1 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute_lag",
benchmark_covariates = "`IMF Program`1",
kd = 2) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
# table F5 is a combination of both tables below
ovb_minimal_reporting(content.sensitivity1)
kd = c(1,2,3) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
# benchmark: IMF program
content.sensitivity1 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute_lag",
benchmark_covariates = "`IMF Program`1",
kd = c(1,2,3)) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
# table F5 is a combination of both tables below
ovb_minimal_reporting(content.sensitivity1)
# benchmark: IMF program
content.sensitivity1 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute_lag",
benchmark_covariates = "`IMF Program`1",
kd = 3) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
# table F5 is a combination of both tables below
ovb_minimal_reporting(content.sensitivity1)
# benchmark: field discovery
content.sensitivity2 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute_lag",
benchmark_covariates = "`Field Discovery`",
kd = 1:3) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
ovb_minimal_reporting(content.sensitivity2)
# benchmark: field discovery
content.sensitivity2 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute_lag",
benchmark_covariates = "`Field Discovery`",
kd = 2) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
ovb_minimal_reporting(content.sensitivity2)
# benchmark: field discovery
content.sensitivity2 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute_lag",
benchmark_covariates = "`Field Discovery`",
kd = 3) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
ovb_minimal_reporting(content.sensitivity2)
pdf("figures/figF1_1.pdf")
plot(content.sensitivity1)
dev.off()
pdf("figures/figF1_2.pdf")
plot(content.sensitivity2)
dev.off()
# benchmark: IMF program
content.sensitivity1 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute_lag",
benchmark_covariates = "`IMF Program`1",
kd = 1:3) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
# benchmark: field discovery
content.sensitivity2 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute_lag",
benchmark_covariates = "`Field Discovery`",
kd = 1:3) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
pdf("figures/figF1_1.pdf")
plot(content.sensitivity1)
dev.off()
pdf("figures/figF1_2.pdf")
plot(content.sensitivity2)
dev.off()
# benchmark: IMF program
content.sensitivity1 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute_lag",
benchmark_covariates = "`IMF Program`1",
kd = 3) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
# benchmark: field discovery
content.sensitivity2 <- sensemakr(model = ols1,
treatment = "resource_mentions_absolute_lag",
benchmark_covariates = "`Field Discovery`",
kd = 3) # investigate the max strength of a confounder 1x, 2x, 3x as strong as the benchmark
pdf("figures/figF1_1.pdf")
plot(content.sensitivity1)
dev.off()
pdf("figures/figF1_2.pdf")
plot(content.sensitivity2)
dev.off()
# load packages
library(rio) # load data
library(tidyverse) # data manipulation
library(stargazer) # generate tables
library(ivreg) # estimate 2SLS
library(lmtest) # cluster standard errors
library(sandwich) # cluster standard erro
# load data for analysis
data_with_dictionary <- import("data/full_data.csv") %>%
mutate(across(c(imf_program,field_discovery,grad_school_econ_usa,iso3c,year), as.factor)) %>% # treat factors as factors
# generate instruments
group_by(iso3c) %>%
mutate(country_specific_resource_mentions_absolute = mean(resource_mentions_absolute),
country_specific_resource_mentions_tfidf = mean(resource_mentions_tfidf)) %>%
ungroup() %>%
group_by(year) %>%
mutate(year_specific_resource_mentions_absolute = mean(resource_mentions_absolute),
year_specific_resource_mentions_tfidf = mean(resource_mentions_tfidf)) %>%
ungroup() %>%
mutate(instrument_absolute = country_specific_resource_mentions_absolute * year_specific_resource_mentions_absolute,
instrument_tfidf = country_specific_resource_mentions_tfidf * year_specific_resource_mentions_tfidf)
# model 1, table F3
ivreg1 <- ivreg(policy_passage ~ resource_mentions_absolute_lag +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c |
instrument_absolute +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c, data = data_with_dictionary)
# cluster standard errors
ivreg1_r <- ivreg1 %>%
coeftest(vcovHC(ivreg1, type = 'HC0', cluster =  ~ iso3c))
# model 2, table F3
ivreg2 <- ivreg(policy_passage ~ resource_mentions_tfidf_lag +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c |
instrument_tfidf +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest + year + iso3c, data = data_with_dictionary)
# cluster standard errors
ivreg2_r <- ivreg2 %>%
coeftest(vcovHC(ivreg2, type = 'HC0', cluster =  ~ iso3c))
summary(ivreg1, diagnostics = T)
# generate figure 6
# load packages
library(rio) # load data
library(tidyverse) # data manipulation
library(sjPlot) # generate plots with predicted probabilities
library(scales) # better breaks for plots
# load data for analysis
data_with_dictionary <- import("data/full_data.csv") %>%
mutate(across(c(imf_program,field_discovery,grad_school_econ_usa,iso3c,year), as.factor)) # treat factors as factors
# estimate a model similar to that of table 2, but averaged across all countries and years
ols1_plot <- lm(policy_passage ~ resource_mentions_absolute +
previous_policy +  grad_school_econ_usa + fdi_performance_index_lag +
imf_program + price_crudeoil_lag + price_crudeoil_difference +
resource_rents_lag + log_gdp_per_capita_lag + gdp_growth_lag + field_discovery_lag +
polyarchy + left_executive + protest, data = data_with_dictionary)
plot_model(ols1_plot, type = "pred", terms = c("resource_mentions_absolute[all]"), colors = "gs",
se = vcovHC(ols1_plot, type = 'HC0', cluster = c('iso3c', 'Summary'))) +
theme_classic() + labs(x = "Natural Resource Term Frequency", y = "Predicted Probability of Policy Passage", title = " ") +
scale_y_continuous(labels = label_percent(scale = 100, accuracy = 1))
ggsave(filename = "figures/fig6.eps", width = 7, height = 5)
ggsave(filename = "figures/fig6.eps", width = 7, height = 5, device=cairo_ps)
install.packages("sessioninfo")
sessioninfo::session_info()
